<?php
/**
 * Created by PhpStorm.
 * User: fangwei
 * Date: 2019-10-02
 * Time: 16:01
 */

namespace App\Http\Controllers\Admin\Api;


use App\Http\Controllers\Controller;
use App\Http\Repositories\Services\ILive;
use App\Util\LayUiVo;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Lang;

class LiveController extends Controller
{
    protected $liveService;

    public function __construct(ILive $liveService)
    {
        $this->liveService = $liveService;
    }

    public function page(Request $request){
        $search = [];
        if ($request->get('product_title')) {
            $search['product_title'] = $request->get('product_title');
        }
        if ($request->get('category_id')) {
            $search['category_id'] = $request->get('category_id');
        }
        $data = $this->liveService->lists($search,$request->get('page',1),$request->get('size'));
        return response()->json(new LayUiVo(['data'=>$data,'message'=>Lang::get('response.success')]));
    }
}